<script>
export default {
  name: "P8",
  components: {},
  data() {
    return {
      imgUrl:'',
      name:'',
      id:''
    }
  },
  methods: {
    doneHandle(result){
      console.log(result);
      var  res = JSON.parse(result.data);
      console.log(res);
      var url = res.data.url;
      console.log(url);
      this.imgUrl=url;
      this.name = res.data.name;
      this.id=res.data.id;
    }
  },
  mounted() {

  }
}
</script>

<template>
  <div>
    <lay-line contentPosition="left">拖拽上传</lay-line>
    <br>
    <lay-panel>

      <lay-upload url="/java/uploadImg"
                  field="file" @done="doneHandle"
          :drag="true"></lay-upload>
      <br>
      <br>
      <div v-if="imgUrl!==''">
        <img width="210px" height="210px" :src="imgUrl" alt="xxx">
        <br>
        <br>
        <lay-form-item label="图片url"  label-width="150px">
          <lay-input style="width: 600px" v-model="imgUrl"  ></lay-input>
        </lay-form-item>
        <lay-form-item label="图片id"  label-width="150px">
          <lay-input style="width: 600px" v-model="id"  ></lay-input>
        </lay-form-item>
        <lay-form-item label="图片原始名称"  label-width="150px">
          <lay-input style="width: 600px" v-model="name"  ></lay-input>
        </lay-form-item>
      </div>


    </lay-panel>
  </div>
</template>

<style scoped>

</style>